package com.zhuss.controller.repair;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import com.zhuss.bean.bo.repair.repair.DetailRepairBo;
import com.zhuss.bean.bo.repair.repair.SearchRepairBo;
import com.zhuss.common.BaseController;
import com.zhuss.common.ReadService;
import com.zhuss.exception.WpsException;



/**
 * 餐品查询 controller
 * @Author zhushanshuo
   @Date 2020/02/28 16:01
 *
 */
  
 
@RestController
@RequestMapping("/repair")
public class RepairReadController extends BaseController {
	
	@Autowired
	@Qualifier("repairReadService")
	private ReadService<Object, Object> repairReadService;
	
	
	/**
	 * 详情
	 * @param bo
	 * @return
	 * @throws WpsException
	 */
	@ResponseBody
	@RequestMapping("/detail")
    public Object detail(@RequestBody DetailRepairBo bo) throws WpsException {
		
		Object result = repairReadService.detail(bo);
		return result;
    }
	
	/**
	 * 列表
	 * @param bo
	 * @return
	 * @throws WpsException
	 */
	@ResponseBody
    @RequestMapping("/list")
    public Object list(@RequestBody SearchRepairBo bo, HttpServletRequest request) throws WpsException {
		String area = request.getHeader("area");
		bo.setArea(Integer.parseInt(area));
		Object result = repairReadService.list(bo);
		return result;
    }
	
}
